Make enum generation private by default, export stub symbol
authorColin Walters <walters@verbum.org>
Thu, 12 May 2016 14:32:17 +0000 (10:32 -0400)
committerColin Walters (automation) <walters+githubbot@verbum.org>
Thu, 12 May 2016 17:15:50 +0000 (17:15 +0000)
When we added enum type generation, the generated symbols used
the `ostree_` prefix, and at the time that implied they were public.

So we started (if built with libsoup) exporting
`ostree_fetcher_config_flags_get_type`.

I think it's not worth confusing ABI checkers, so let's export the
dummy symbol forever, and switch enums to be private by default.

We should revisit this and also export some auto-generated enum
types for public enums, but that's a separate patch.

Closes: #296
Approved by: gatispaeglis

Makefile-libostree-defines.am
Makefile-libostree.am
src/libostree/ostree-dummy-enumtypes.c [new file with mode: 0644]
src/libostree/ostree-dummy-enumtypes.h [new file with mode: 0644]
src/libostree/ostree-enumtypes.c.template
src/libostree/ostree-enumtypes.h.template

index f623900c37e1e6211cb974dbe64536dbf27fdbcb..1db75e0ca1166667a762c4fb56e0e1f1c4aa62f7 100644 (file)
@@ -22,6 +22,7 @@ libostree_public_headers = \
        src/libostree/ostree.h \
        src/libostree/ostree-async-progress.h \
        src/libostree/ostree-core.h \
+       src/libostree/ostree-dummy-enumtypes.h \
        src/libostree/ostree-mutable-tree.h \
        src/libostree/ostree-repo.h \
        src/libostree/ostree-types.h \
index a50b2b9d8a3bd5344407238177a1ee48a9316573..affdd745a1b9d02be320066e3b8f5b4538f44a94 100644 (file)
@@ -69,6 +69,7 @@ libostree_1_la_SOURCES = \
        src/libostree/ostree-cmdprivate.c \
        src/libostree/ostree-core-private.h \
        src/libostree/ostree-core.c \
+       src/libostree/ostree-dummy-enumtypes.c \
        src/libostree/ostree-checksum-input-stream.c \
        src/libostree/ostree-checksum-input-stream.h \
        src/libostree/ostree-chain-input-stream.c \
diff --git a/src/libostree/ostree-dummy-enumtypes.c b/src/libostree/ostree-dummy-enumtypes.c
new file mode 100644 (file)
index 0000000..27fc7b4
--- /dev/null
@@ -0,0 +1,32 @@
+/* This file declares a stub function that is only exported
+ * to pacify ABI checkers - no one could really have used it.
+ *
+ * Copyright (C) 2015 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "ostree-dummy-enumtypes.h"
+
+/* Exported for backwards compat - see 
+ * https://bugzilla.gnome.org/show_bug.cgi?id=764131
+ * https://github.com/ostreedev/ostree/pull/294
+ */
+GType
+ostree_fetcher_config_flags_get_type (void)
+{
+  return G_TYPE_INVALID;
+}
diff --git a/src/libostree/ostree-dummy-enumtypes.h b/src/libostree/ostree-dummy-enumtypes.h
new file mode 100644 (file)
index 0000000..e58e188
--- /dev/null
@@ -0,0 +1,29 @@
+/* This file declares a stub function that is only exported
+ * to pacify ABI checkers - no one could really have used it.
+ *
+ * Copyright (C) 2015 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <glib-object.h>
+
+#ifndef __GI_SCANNER__
+_OSTREE_PUBLIC GType
+ostree_fetcher_config_flags_get_type (void);
+#endif
index fe8807ae7d518817e28e2df5a1934d07ae0be058..ab1b2aec7586a0846aba8ef23d88670af04f9092 100644 (file)
@@ -28,7 +28,7 @@
 
 /*** BEGIN value-header ***/
 GType
-@enum_name@_get_type (void)
+_@enum_name@_get_type (void)
 {
   static volatile gsize the_type__volatile = 0;
 
index 40899d7fac28f39d55b53595e94bfa093ec083ce..ec20fe0d18a553f0b80724aeff9f6ed2f6348b52 100644 (file)
@@ -32,9 +32,8 @@ G_BEGIN_DECLS
 /*** END file-production ***/
 
 /*** BEGIN enumeration-production ***/
-#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
-_OSTREE_PUBLIC
-GType @enum_name@_get_type (void) G_GNUC_CONST;
+#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (_@enum_name@_get_type ())
+GType _@enum_name@_get_type (void) G_GNUC_CONST;
 
 /*** END enumeration-production ***/